<?php
$articleid = $_POST['article_id'];
$title = $_POST['title'];
$content = $_POST['content'];
$categoryid = $_POST['category_id'];

//当前时间戳
$time = time();
date_default_timezone_set("PRC");

$dsn = "mysql:host=127.0.0.1;dbname=blog";
$db = new PDO($dsn,"root","123456");
//设计字符集
$db->exec("set names utf8mb4");

$sql = "UPDATE article SET category_id ='$categoryid',article_title='$title',content ='$content',update_time='$time',add_time='$time'
where article_id = '$articleid'";
$result = $db->exec($sql);
if($result){
    echo "修改成功";
    echo "<a href='article.php'>点击返回列表页面</a>";
    exit();
}else{
    echo "修改失败，错误信息".$db->errorInfo()[2]."请联系管理员";
    echo "<a href='article.php'>点击返回列表页面</a>";
}